#ifndef PAINTBOARDWIDGET_H
#define PAINTBOARDWIDGET_H

#include <QWidget>
#include <QGraphicsItem>

namespace Ui {
class CPaintBoardWidget;
}

class QGraphicsScene;

class CScaleItem : public QGraphicsItem
{
public:
    CScaleItem(const QRect& rect, QGraphicsItem* parent = nullptr);
    ~CScaleItem();

protected:
    QRectF boundingRect() const override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;

    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
private:
    QGraphicsRectItem* m_subItem = nullptr;
    QRect m_rect;
};

class CPaintBoardWidget : public QWidget
{
    Q_OBJECT

public:
    explicit CPaintBoardWidget(QWidget *parent = nullptr);
    ~CPaintBoardWidget();

private:
    void Init();

private:
    Ui::CPaintBoardWidget *ui;

    QGraphicsScene* m_scene = nullptr;
};

#endif // PAINTBOARDWIDGET_H
